// -------------------------------------------------------------------------
//    @FileName			:    NFCGameServerNet_ServerModule.h
//    @Author           :    LvSheng.Huang
//    @Date             :    2013-01-02
//    @Module           :    NFCGameServerNet_ServerModule
//    @Desc             :
// -------------------------------------------------------------------------

#ifndef PLAYERMODULE_H
#define PLAYERMODULE_H

#include "stdafx.h"
class Player;
class PlayerDbModule;
class PlayerModule : public NFIModule
{
public:
	PlayerModule(NFIPluginManager* p)
	{
		pPluginManager = p;
	}
	virtual bool Init();
	virtual bool Shut();
	virtual bool Execute();
	virtual bool AfterInit();
public:
	int OnPlayerLoginSuccess(const NFGUID& ngAccId, const int nSocketId);
	NF_SHARE_PTR<Player> GetPlayer(const NFGUID& ngAccId);
	bool OnPlayerLoginLogOut(const NFGUID& ngAccId);

public:
	NFINetModule* GetNetModule() { return m_pNetModule; }
	NFIAsyMysqlModule* GetAsyMysqlModule() { return m_pAsyMysqlModule; }
	PlayerDbModule *  GetPlayerDbModule() { return m_pPlayerDbModule; }
	bool SendPacket(int nSocketId, PK pk, const google::protobuf::Message & xData);
private:
	NFMapEx<NFGUID, Player> mxPlayerPool;
	NFList<NFGUID> m_RemovePlayers;
	NFINetModule* m_pNetModule;
	NFIAsyMysqlModule* m_pAsyMysqlModule;
	PlayerDbModule * m_pPlayerDbModule;
};

#endif